CC = g++
CFLASS = -c -Wall
MKDIR = mkdir
NOERROR = -lGLEW -lEGL -lGL -lGLU -lOpenGL -lglfw -lrt -lm -ldl -lX11 -lpthread -lxcb -lXau -lXdmcp

GUI_O = build/GUI_o/GUI.o
MENU_O = build/GUI_o/Menu_o/Menu.o
ENGINE_O = build/Engine/main_engine.o

all: compilation start

compilation: build main.o GUI.o engine.o menu.o
	$(CC) build/main.o $(GUI_O) $(MENU_O) $(ENGINE_O) -o game $(NOERROR)

build:
	$(MKDIR) build
	$(MKDIR) build/GUI_o
	$(MKDIR) build/GUI_o/Game_o
	$(MKDIR) build/GUI_o/Menu_o
	$(MKDIR) build/Engine

main.o: src/main.cpp
	$(CC) $(CFLASS) src/main.cpp -o build/main.o 

GUI.o: src/Engine/GUI/GUI.cpp
	$(CC) $(CFLASS) src/Engine/GUI/GUI.cpp -o build/GUI_o/GUI.o

engine.o: src/Engine/MainEngine.cpp
	$(CC) $(CFLASS) src/Engine/MainEngine.cpp -o build/Engine/main_engine.o

menu.o: src/Engine/GUI/menu/main_menu.cpp
	$(CC) $(CFLASS) src/Engine/GUI/menu/main_menu.cpp -o build/GUI_o/Menu_o/Menu.o

start: game
	./game